package pt.iscte.pcd.project.client;

import java.io.IOException;

import pt.iscte.pcd.project.order.Order;

public class DealWithServerReceiver extends Thread{
	private DealWithServer dealServer;

	
	public DealWithServerReceiver(DealWithServer dealServer) {
		this.setDealServer(dealServer);
		
	}
	
	@Override
	public void run() {
		super.run();
		while(! isInterrupted()){
			try {
				Order order = (Order) dealServer.getIn().readObject();
				dealServer.porPedidosNaListaRecebidos(order);
				new ClientWorker(dealServer).start();
			} catch (ClassNotFoundException e) {
			} catch (IOException e) {
			}
		}
		
	}


	public DealWithServer getDealServer() {
		return dealServer;
	}


	public void setDealServer(DealWithServer dealServer) {
		this.dealServer = dealServer;
	}
	
	
	

}
